Figure 4 showcases the geomeTriD package, demonstrating
how it presents 3D models generated from Dip-C.
This data were downloaded from GEO with accession GSE117874.
## set the data folder, all data are available in the extdata folder of this package
extdata <- system.file('extdata', 'GSE117874', package='geomeTriD.documentation')
hickit_3dg <- dir(extdata, '3dg', full.names = TRUE)
hickit <- import3dg(hickit_3dg, parental_postfix=c('a', 'b'))[[1]]
## split it into maternal and paternal 3D structures.
hickit.a <- hickit[hickit$parental=='a'] ## mat
hickit.b <- hickit[hickit$parental=='b'] ## pat
## delete the parental information
hickit.a$parental <- hickit.b$parental <- NULL
## set data range
range <- GRanges('X:1-155270560')
## prepare the coordinates for the four superloops.
features <- GRanges(c('X:56800000-56850000',
'X:75350000-75400000',
'X:115000000-115050000',
'X:130850000-130900000'))
names(features) <- c('ICCE', 'x75', 'DXZ4', 'FIRRE')
features$label <- names(features)
features$col <- 2:5 ## set colors for each element
features$type <- 'gene' ## set it as gene
## add the superloops as segments
c1 <- view3dStructure(hickit.a,
feature.gr=features,
renderer = 'none',
region = range,
resolution=3,
show_coor=FALSE,
lwd.backbone = 0.25,
lwd.gene=6)
c2 <- view3dStructure(hickit.b,
feature.gr=features,
renderer = 'none',
region = range,
resolution=3,
show_coor=FALSE,
lwd.backbone = 0.25,
lwd.gene=6)
c2 <- lapply(c2, function(.ele) { ## put pat to right pannel
.ele$side = 'right'
.ele
})
## view the data
threeJsViewer(c1, c2, title = c('GM12878 cell 3 mat', 'GM12878 cell 3 pat'))
#widget <-threeJsViewer(c1, c2, title = c('mat', 'pat'))
#tempfile <- 'Fig4.html'
#htmlwidgets::saveWidget(widget, file=tempfile)
#utils::browseURL(tempfile)
## view the superloops as spheres
addFeaturesAsSphere <- function(obj, features, ...){
backbone <- extractBackbonePositions(obj)
spheres <- createTADGeometries(features, backbone, ...)
c(obj, spheres)
}
mat <- view3dStructure(hickit.a, renderer = 'none', region = range,
resolution=3, show_coor=FALSE, lwd.backbone = 0.25)
mat <- addFeaturesAsSphere(mat, features, alpha = 0.5)
pat <- view3dStructure(hickit.b, renderer = 'none', region = range,
resolution=3, show_coor=FALSE, lwd.backbone = 0.25)
pat <- addFeaturesAsSphere(pat, features, alpha = 0.5)
showPairs(mat, pat, title = c('GM12878 cell 3 mat', 'GM12878 cell 3 pat'), height = NULL)
## load the processed data.
hickit.a <- readRDS(file.path(extdata, 'hickit.a.rds'))
hickit.b <- readRDS(file.path(extdata, 'hickit.b.rds'))
widgets <- mapply(function(a, b, i){
mat <- view3dStructure(a, renderer = 'none', region = range,
resolution=1, show_coor=FALSE, lwd.backbone = 0.25)
mat <- addFeaturesAsSphere(mat, features, alpha = 0.5)
pat <- view3dStructure(b, renderer = 'none', region = range,
resolution=1, show_coor=FALSE, lwd.backbone = 0.25)
pat <- addFeaturesAsSphere(pat, features, alpha = 0.5)
showPairs(mat, pat, title = paste('cell', i, c('mat', 'pat')),
background = c("#11111188",
"#222222DD",
"#222222DD",
"#11111188"),
height = NULL)
}, hickit.a, hickit.b, names(hickit.a), SIMPLIFY = FALSE)
widgets[[1]]
widgets[[5]]## R version 4.5.0 (2025-04-11)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.2 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] GenomicRanges_1.61.0 GenomeInfoDb_1.45.3
## [3] IRanges_2.43.0 S4Vectors_0.47.0
## [5] BiocGenerics_0.55.0 generics_0.1.4
## [7] geomeTriD.documentation_0.0.2 geomeTriD_1.3.6
##
## loaded via a namespace (and not attached):
## [1] strawr_0.0.92 RColorBrewer_1.1-3
## [3] rstudioapi_0.17.1 jsonlite_2.0.0
## [5] magrittr_2.0.3 GenomicFeatures_1.61.2
## [7] farver_2.1.2 rmarkdown_2.29
## [9] fs_1.6.6 BiocIO_1.19.0
## [11] ragg_1.4.0 vctrs_0.6.5
## [13] memoise_2.0.1 Rsamtools_2.25.0
## [15] RCurl_1.98-1.17 base64enc_0.1-3
## [17] htmltools_0.5.8.1 S4Arrays_1.9.0
## [19] progress_1.2.3 plotrix_3.8-4
## [21] curl_6.2.2 Rhdf5lib_1.31.0
## [23] rhdf5_2.53.0 SparseArray_1.9.0
## [25] Formula_1.2-5 sass_0.4.10
## [27] parallelly_1.44.0 bslib_0.9.0
## [29] htmlwidgets_1.6.4 desc_1.4.3
## [31] Gviz_1.53.0 httr2_1.1.2
## [33] cachem_1.1.0 GenomicAlignments_1.45.0
## [35] igraph_2.1.4 lifecycle_1.0.4
## [37] pkgconfig_2.0.3 Matrix_1.7-3
## [39] R6_2.6.1 fastmap_1.2.0
## [41] MatrixGenerics_1.21.0 future_1.49.0
## [43] digest_0.6.37 colorspace_2.1-1
## [45] AnnotationDbi_1.71.0 textshaping_1.0.1
## [47] Hmisc_5.2-3 RSQLite_2.3.11
## [49] filelock_1.0.3 progressr_0.15.1
## [51] httr_1.4.7 abind_1.4-8
## [53] compiler_4.5.0 bit64_4.6.0-1
## [55] htmlTable_2.4.3 backports_1.5.0
## [57] BiocParallel_1.43.2 DBI_1.2.3
## [59] R.utils_2.13.0 biomaRt_2.65.0
## [61] MASS_7.3-65 rappdirs_0.3.3
## [63] DelayedArray_0.35.1 rjson_0.2.23
## [65] tools_4.5.0 foreign_0.8-90
## [67] future.apply_1.11.3 nnet_7.3-20
## [69] R.oo_1.27.1 glue_1.8.0
## [71] restfulr_0.0.15 dbscan_1.2.2
## [73] InteractionSet_1.37.0 rhdf5filters_1.21.0
## [75] grid_4.5.0 checkmate_2.3.2
## [77] cluster_2.1.8.1 gtable_0.3.6
## [79] BSgenome_1.77.0 trackViewer_1.45.0
## [81] R.methodsS3_1.8.2 ensembldb_2.33.0
## [83] data.table_1.17.2 hms_1.1.3
## [85] xml2_1.3.8 XVector_0.49.0
## [87] RANN_2.6.2 pillar_1.10.2
## [89] stringr_1.5.1 dplyr_1.1.4
## [91] BiocFileCache_2.99.5 lattice_0.22-7
## [93] deldir_2.0-4 rtracklayer_1.69.0
## [95] bit_4.6.0 biovizBase_1.57.0
## [97] tidyselect_1.2.1 Biostrings_2.77.1
## [99] knitr_1.50 gridExtra_2.3
## [101] ProtGenerics_1.41.0 SummarizedExperiment_1.39.0
## [103] xfun_0.52 Biobase_2.69.0
## [105] matrixStats_1.5.0 stringi_1.8.7
## [107] UCSC.utils_1.5.0 lazyeval_0.2.2
## [109] yaml_2.3.10 evaluate_1.0.3
## [111] codetools_0.2-20 interp_1.1-6
## [113] tibble_3.2.1 cli_3.6.5
## [115] rpart_4.1.24 systemfonts_1.2.3
## [117] jquerylib_0.1.4 dichromat_2.0-0.1
## [119] Rcpp_1.0.14 globals_0.18.0
## [121] grImport_0.9-7 dbplyr_2.5.0
## [123] png_0.1-8 XML_3.99-0.18
## [125] parallel_4.5.0 pkgdown_2.1.2
## [127] rgl_1.3.18 ggplot2_3.5.2
## [129] blob_1.2.4 prettyunits_1.2.0
## [131] jpeg_0.1-11 latticeExtra_0.6-30
## [133] AnnotationFilter_1.33.0 bitops_1.0-9
## [135] txdbmaker_1.5.3 listenv_0.9.1
## [137] VariantAnnotation_1.55.0 scales_1.4.0
## [139] crayon_1.5.3 rlang_1.1.6
## [141] KEGGREST_1.49.0